<script setup>
import { ref, onMounted, watch } from 'vue'
import * as echarts from 'echarts'

const props = defineProps({
    option: Object
})

const node = ref(null)
let chart = null
onMounted(() => {
    chart = echarts.init(node.value)
    chart.setOption(props.option)
})

watch(props, () => {
    chart.setOption(props.option)
})

</script>
<template>
    <div ref="node"></div>
</template>
<style scoped>
div{
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}
</style>
